package com.winter.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.model.IApply;
import com.winter.model.NewCollect;
import com.winter.model.NewExpertForum;
import com.winter.model.NewGossip;
import com.winter.model.NewGossipComment;
import com.winter.model.NewGossipLike;
import com.winter.model.NewOrg;
import com.winter.model.NewTradeSalon;
import com.winter.service.ThinkTankService;
import com.winter.util.Result;


/**
 * 智库模块
 */
@RestController
@RequestMapping(value = "v1/think_tank")
public class ThinkTankController {

    @Autowired
    private ThinkTankService thinkTankService;

    /**
     * 智库专家
     */
    @GetMapping("specialist")
    public Result specialistList(String key, Integer pageSize, Integer pageNumber) {
        return thinkTankService.specialistList(key, pageSize, pageNumber);
    }

    /**
     * 高级论坛列表
     */
    @GetMapping("high_forum")
    public Result highForumList(String keyword, Integer pageSize, Integer pageNumber, String type, String key) {
        return thinkTankService.highForumList(keyword, pageSize, pageNumber, type, key);

    }

    /**
     * 高级论坛详情
     */
    @GetMapping("high_forum_details")
    public Result highForumDetails(Long id, String userId) {

        return thinkTankService.highForumDetails(id, userId);
    }

    /**
     * 报名高级论坛
     */
    @PostMapping("apply/expert_forum")
    public Result applySeniorForum(@RequestBody NewExpertForum newExpertForum) {
        return thinkTankService.applySeniorForum(newExpertForum);
    }

    /**
     * 报名同业沙龙
     */
    @PostMapping("apply/trade_salon")
    public Result applyTradeSalon(@RequestBody NewTradeSalon newTradeSalon) {

        return thinkTankService.applyTradeSalon(newTradeSalon);
    }

    /**
     * 申请入驻机构
     */
    @PostMapping("add_org")
    public Result insertOrg(@RequestBody NewOrg newOrg) {
        return thinkTankService.insertOrg(newOrg);
    }

    /**
     * 机构列表
     */
    @GetMapping("org")
    public Result orgList(Integer pageSize, Integer pageNumber, String key) {
        return thinkTankService.orgList(pageSize, pageNumber, key);
    }

    /**
     * 机构详情
     */
    @GetMapping("org_detail")
    public Result orgDetail(String id) {
        return thinkTankService.orgDetail(id);
    }

    /**
     * 机构研报
     */
    @GetMapping("org_report")
    public Result orgReportList(Integer pageSize, Integer pageNumber, String orgId, String userId, String id, String key) {
        return thinkTankService.orgReportList(pageSize, pageNumber, orgId, userId, id, key);
    }

    /**
     * 机构详情
     */
    @GetMapping("org_report_detail")
    public Result orgReportDetail(Long id, Long userId, String userNo) {
        return thinkTankService.orgReportDetail(id, userId, userNo);
    }

    /**
     * 发布八卦
     */
    @PostMapping("publish/gossip")
    public Result insertGossip(@RequestBody NewGossip newGossip) {
        return thinkTankService.insertGossip(newGossip);
    }


    /**
     * 点赞八卦
     */
    @PostMapping("like/gossip")
    public Result likeGossip(@RequestBody NewGossipLike newGossipLike) {
        return thinkTankService.likeGossip(newGossipLike);
    }

    /**
     * 取消点赞
     */
    @DeleteMapping("cancel/gossip")
    public Result cancelGossip(String gossipId, Long userId) {
        return thinkTankService.cancelGossip(gossipId, userId);
    }

    /**
     * 八卦列表
     */
    @GetMapping("gossip")
    public Result gossipList(Integer pageSize, Integer pageNumber, Long userId, Integer type, String keyword) {
        return thinkTankService.gossipList(pageSize, pageNumber, userId, type, keyword);
    }

    /**
     * 八卦列表详情
     */
    @GetMapping("gossip/detail")
    public Result gossipDetail(String gossipId, Long userId) {
        return thinkTankService.gossipDetail(gossipId, userId);
    }

    /**
     * 八卦评论
     */
    @GetMapping("gossip/comment")
    public Result gossipComment(String gossipId, Integer pageSize, Integer pageNumber) {
        return thinkTankService.gossipComment(gossipId, pageSize, pageNumber);
    }

    /**
     * 删除八卦
     */
    @DeleteMapping("delete/gossip")
    public Result deleteGossip(String gossipId, Long userId) {
        return thinkTankService.deleteGossip(gossipId, userId);
    }


    @DeleteMapping("show/gossip")
    public Result isShow(String gossipId, Long userId, Integer type) {
        return thinkTankService.isShow(gossipId, userId, type);
    }

    /**
     * 评论|| 八卦
     */
    @PostMapping("comment/gossip")
    public Result commentGossip(@RequestBody NewGossipComment newGossipComment) {
        return thinkTankService.commentGossip(newGossipComment);
    }

    /**
     * 收藏
     */
    @PostMapping("collect")
    public Result collect(@RequestBody NewCollect newCollect) {
        return thinkTankService.collect(newCollect);
    }

    /**
     * 取消收藏
     */
    @DeleteMapping("cancel_collect")
    public Result cancelCollect(String sourceId, String type, Long userId) {
        return thinkTankService.cancelCollect(sourceId, type, userId);
    }

    /**
     * 报名
     */
    @PostMapping("apply")
    public Result apply(@RequestBody IApply iApply) {
        return thinkTankService.apply(iApply);
    }

    /**
     * 课件列表
     */
    @GetMapping("courseware")
    public Result courseWare(Integer type, String keyword, Integer pageSize, Integer pageNumber) {
        return thinkTankService.courseWare(type, keyword, pageSize, pageNumber);
    }

    /**
     * 修改报名
     */
    @PutMapping("update")
    public Result update(@RequestBody IApply iApply) {
        return thinkTankService.update(iApply);
    }
}

